home *** CD-ROM | disk | FTP | other *** search
/ Enter 2004 February / EnterCD 02_2004.iso / Gry / Arcade! Classic Arcade Pack 2.0 / Arcade.EXE / $PROGRAMFILES / Arcade! Classic Arcade Pack / snake.swf / scripts / frame_3 / DoAction.as
Encoding:
Text File  |  2003-12-05  |  741 b   |  41 lines

  1. Key.removeListener(keyListener);
  2. score = 0;
  3. len = 2;
  4. gx = 21;
  5. gy = 15;
  6. max = (gx - 2) * (gy - 2) - 3;
  7. vx = 0;
  8. vy = 1;
  9. x = 11;
  10. y = 4;
  11. gameOver = paused = moved = false;
  12. levelName = "LEVEL: " + ["PYTHON","WORM","SLUG"][level];
  13. var i = 0;
  14. while(i <= gx)
  15. {
  16.    s_mc.createEmptyMovieClip(i,i);
  17.    var j = 0;
  18.    while(j <= gy)
  19.    {
  20.       s_mc[i].attachMovie("snake",j,j,{_x:i * 12,_y:j * 12,_visible:false,fuse:0});
  21.       j++;
  22.    }
  23.    i++;
  24. }
  25. makeFood = function()
  26. {
  27.    do
  28.    {
  29.       fx = int(Math.random() * (gx - 1)) + 1;
  30.       fy = int(Math.random() * (gy - 1)) + 1;
  31.    }
  32.    while(s_mc[fx][fy]._visible);
  33.    
  34.    with(s_mc[fx][fy])
  35.    {
  36.       fuse = 75;
  37.       gotoAndStop(2);
  38.       _visible = true;
  39.    }
  40. };
  41.